package org.apache.commons.httpclient;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class HeaderGroup
{
  private List headers = new ArrayList();

  public void addHeader(Header paramHeader)
  {
    this.headers.add(paramHeader);
  }

  public void clear()
  {
    this.headers.clear();
  }

  public boolean containsHeader(String paramString)
  {
    Iterator localIterator = this.headers.iterator();
    do
      if (!(localIterator.hasNext()))
        break;
    while (!(((Header)localIterator.next()).getName().equalsIgnoreCase(paramString)));
    for (int i = 1; ; i = 0)
      return i;
  }

  public Header[] getAllHeaders()
  {
    return ((Header[])(Header[])this.headers.toArray(new Header[this.headers.size()]));
  }

  public Header getCondensedHeader(String paramString)
  {
    Header[] arrayOfHeader = getHeaders(paramString);
    if (arrayOfHeader.length == 0);
    StringBuffer localStringBuffer;
    for (Header localHeader = null; ; localHeader = new Header(paramString.toLowerCase(), localStringBuffer.toString()))
    {
      while (true)
      {
        return localHeader;
        if (arrayOfHeader.length != 1)
          break;
        localHeader = new Header(arrayOfHeader[0].getName(), arrayOfHeader[0].getValue());
      }
      localStringBuffer = new StringBuffer(arrayOfHeader[0].getValue());
      for (int i = 1; i < arrayOfHeader.length; ++i)
      {
        localStringBuffer.append(", ");
        localStringBuffer.append(arrayOfHeader[i].getValue());
      }
    }
  }

  public Header getFirstHeader(String paramString)
  {
    Iterator localIterator = this.headers.iterator();
    Header localHeader2;
    do
    {
      if (!(localIterator.hasNext()))
        break;
      localHeader2 = (Header)localIterator.next();
    }
    while (!(localHeader2.getName().equalsIgnoreCase(paramString)));
    for (Header localHeader1 = localHeader2; ; localHeader1 = null)
      return localHeader1;
  }

  public Header[] getHeaders(String paramString)
  {
    ArrayList localArrayList = new ArrayList();
    Iterator localIterator = this.headers.iterator();
    while (localIterator.hasNext())
    {
      Header localHeader = (Header)localIterator.next();
      if (!(localHeader.getName().equalsIgnoreCase(paramString)))
        continue;
      localArrayList.add(localHeader);
    }
    return ((Header[])(Header[])localArrayList.toArray(new Header[localArrayList.size()]));
  }

  public Iterator getIterator()
  {
    return this.headers.iterator();
  }

  public Header getLastHeader(String paramString)
  {
    int i = this.headers.size() - 1;
    label12: Header localHeader2;
    if (i >= 0)
    {
      localHeader2 = (Header)this.headers.get(i);
      if (!(localHeader2.getName().equalsIgnoreCase(paramString)));
    }
    for (Header localHeader1 = localHeader2; ; localHeader1 = null)
    {
      return localHeader1;
      --i;
      break label12:
    }
  }

  public void removeHeader(Header paramHeader)
  {
    this.headers.remove(paramHeader);
  }

  public void setHeaders(Header[] paramArrayOfHeader)
  {
    clear();
    for (int i = 0; i < paramArrayOfHeader.length; ++i)
      addHeader(paramArrayOfHeader[i]);
  }
}

/* Location:           E:\Desktop\Android\wordstd\classes_dex2jar.jar
 * Qualified Name:     org.apache.commons.httpclient.HeaderGroup
 * JD-Core Version:    0.5.3
 */